import { pget, ppostJson } from '@/utils/req';
import { modalApi } from '@/utils/modalReq';

// 获取司机分页
export function getTableList(query: any) {
  return pget(`${modalApi.customer}/drivers/page`, query);
}
// 获取滴滴司机分页
export function getDdDriverTableList(query?: any) {
  if (window.apiPrefixUri) {
    return pget(`${window.apiPrefixUri}/mgrApi/driver-api/driver/list`, query)
  }
  return pget(`${modalApi.customer}/drivers/page`, query);
}
// 司管员添加司机
export function getPageByAdmin(query: any) {
  return pget(`${modalApi.customer}/drivers/pageByAdmin`, query);
}

// 新增司机
export function addDriverRequest(data: any) {
  return ppostJson(`${modalApi.customer}/drivers/save`, data);
}

// 获取司机详情
export function driverDetailRequest(data: any) {
  return pget(`${modalApi.customer}/drivers/detail`, data);
}

// 修改司机
export function driverEditRequest(data: any) {
  return ppostJson(`${modalApi.customer}/drivers/update`, data);
}

// 获取司机信息列表分页
export function getDriverOrderList(query: any) {
  return pget(`${modalApi.customer}/driver/order/list`, query);
}

// 获取司机违规列表分页
export function getDriverillegalList(query: any) {
  return pget(`${modalApi.customer}/driver/order/illegal/list`, query);
}

// 获取司机违规列表分页
export function getDriverHistoryOrderlList(query: any) {
  return pget(`${modalApi.customer}/driver/order/history/list`, query);
}

// 生成司机编号
export function createDriverCode() {
  return pget(`${modalApi.customer}/drivers/createDriverId`);
}

/** 获取司机导入错误页列表 */
export function getErrorListPage(query: any) {
  return pget(`${modalApi.customer}/drivers/errorListPage`, query);
}
/** 司机导入数据提交 */
export function getImportData(query: any) {
  return pget(`${modalApi.customer}/drivers/importData`, query);
}


/** 司机 */
export function getDriverbyCarId(query: any) {
  return pget(`${modalApi.customer}/drivers/getDriverbyCarId`, query);
}
// 导出司机
export function driverExport() {
  return ppostJson(`${modalApi.customer}/drivers/export`);
}

// 获取司机
export function getSelectDriverBase(query: any) {
  return pget(`${modalApi.customer}/drivers/selectDriverBase`, query);
}


/** 验证司机是否存在 */
export function getDriverPresent(query?: any) {
  if (window.apiPrefixUri) {
    return pget(`${window.apiPrefixUri}/mgrApi/driver-api/driver/getDriverInfoByCondition`, query)
  }
  return pget(`${modalApi.customer}/drivers/driverPresent`, query);
}
// export function getDriverPresent(query: any) {
//   return pget(`${modalApi.customer}/drivers/driverPresent`, query);
// }

// 获取滴滴司机详情
export function getDdDriverDetail(params: any) {
  return pget(`${window.apiPrefixUri}/mgrApi/driver-api/driver/get`, params);
}